from lib.net.index import http
from utils import device

def get_poem_action():
    """
    获取POEM操作
    """
    payload = {
        "type": "query",
        "name": "poem",
        "data": {
            "device_id": device.get_id(),
            "device_info": device.get_info(),
        },
    }
    print("send fetch poem request")
    resp = http.POST("http://www.hanxiaoxin.cn:8080/action", payload)
    return resp

def get_ws2812_action():
    """
    获取WS2812操作
    """
    payload = {
        "type": "query",
        "name": "ws2812",
        "data": {
            "device_id": device.get_id(),
            "device_info": device.get_info(),
        },
    }
    print("send fetch ws28112 request")
    resp = http.POST("http://www.hanxiaoxin.cn:8080/action", payload)
    return resp

def get_tts_action(play=False):
    """
    获取tts操作
    """
    payload = {
        "type": "query",
        "name": "tts",
        "data": {
            "device_id": device.get_id(),
            "device_info": device.get_info(),
        },
    }
    print("send fetch tts request")
    resp = http.POST("http://www.hanxiaoxin.cn:8080/action", payload)
    return resp